package com.still.springinactionlearning.proxy;

import java.lang.reflect.GenericDeclaration;
import java.util.Date;

/**
 * @program: springinactionlearninf
 * @description:
 * @author: jyxiao
 * @create: 2022-11-28 14:40
 **/
public class UserServiceProxy implements UserService {
    private UserService target;

    public UserServiceProxy(UserService target) {
        this.target = target;
    }

    @Override
    public void select() {
        before();
        target.select();
        after();
    }

    @Override
    public void update() {
        before();
        target.update();
        after();
    }

    private void before() {
        System.out.println(String.format("log start time [%s]", new Date()));
    }

    private void after() {
        System.out.println(String.format("log end time [%s]", new Date()));
    }

}
